package com.architecture.persistence.dao;

import java.io.Serializable;
import java.util.Collection;

import com.architecture.entity.Entity;

/**
 * <p>Base of all Data Access Objects<p>
 * @author JR
 * @param <E>
 */
public interface DAO<E extends Entity> {

	
	/**
	 * <p>List all entities.<p>
	 * @return Collection
	 */
	Collection<E> list();
	
	/**
	 * <p>List entities using a interval.<p>
	 * @param start
	 * @param end
	 * @return Collection
	 */
	Collection<E> list(final int start, final int end);
	
	/**
	 * <p>Creates a new entity.</p>
	 * @param entity
	 * @return <code>Serializable</code>
	 */
	Serializable create(E entity);
	
	/**
	 * <p>Reads data of an entity using the identifier of the entity.</p>
	 * @param id
	 * @return E
	 */
	E read(final Serializable id);
	
	/**
	 * <p>Update data of an entity.</p>
	 * @param entity
	 */
	void update(E entity);
	
	/**
	 * <p>Delete an entity using its identifier.<p>
	 * @param id
	 */
	void delete(Serializable id);
	
}
